package fg.tests;

import org.newdawn.slick.BasicGame;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;

import fg.Consts;
import fg.Resources;
import fg.objects.Rod;

public class TestPoleCasting extends BasicGame {
	
	private Rod rod;
	
	public TestPoleCasting() {
	    super("Test Pole Casting");
    }

	@Override
    public void init(GameContainer container) throws SlickException {
		Resources.initialize();
		
	    rod = new Rod();
	    rod.setPosition(200f, 400f);
	    rod.rotate(-45f);
    }

	@Override
    public void update(GameContainer container, int delta) throws SlickException {
		Input input = container.getInput();
		rod.update(delta);
		if (input.isKeyPressed(Input.KEY_SPACE)) {
			rod.action();
		}
    }

	public void render(GameContainer container, Graphics g) throws SlickException {
		g.setColor(Color.blue);
		g.fillRect(0f, Consts.WATER_Y, 800f, 600f);
		g.setColor(Color.white);
		rod.render(g);
	}
	
}
